package com.example.sinoyd.frameapplication.ProjectCodes.UI

import android.os.Bundle
import android.os.Handler
import android.system.Os
import com.example.sinoyd.frameapplication.KotlinFrame.Frame.Uitl.JudgNetwork
import com.example.sinoyd.frameapplication.KotlinFrame.Frame.Uitl.SystemUtil
import com.example.sinoyd.frameapplication.KotlinFrame.MainActivity
import com.example.sinoyd.frameapplication.KotlinFrame.UI.BaseActivity
import com.example.sinoyd.frameapplication.R
import com.google.gson.Gson
import com.sinoyd.Code.Until.SharedPreferencesFactory
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast

class LoadingActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_loading)
        //获取屏幕尺寸
        SystemUtil.getScreen(this)
        //判断网络连接是否正常
        if (JudgNetwork(this)) {
            val handler = Handler()
            handler.postDelayed({

                if (SharedPreferencesFactory.getdata(this, "username") == "" || SharedPreferencesFactory.getdata(this, "password") == "") {
                    startActivity<LoginActivity>()
                    finish()
                } else {
                    startActivity<OsChooseActivity>()
                    finish()
                }


            }, 1000)
        } else {
            toast("网络故障，请检查网络是否连接")
        }
    }




}
